package home.conta.bancodedados;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

@Deprecated
public class MySQLiteHelper extends SQLiteOpenHelper {

	public static final String TABLE_DIVIDAS = "dividas";
	public static final String COLUMN_ID = "_id";
	public static final String COLUMN_NOME = "nome";
	public static final String COLUMN_VALOR = "valor";
	public static final String COLUMN_DATAVENC = "datavencimento";
	public static final String COLUMN_DATAPAG = "datapagamento";
	public static final String COLUMN_ISPAGA = "ispaga";

	private static final String DATABASE_NAME = "commments.db";
	private static final int DATABASE_VERSION = 1;

	// Database creation sql statement
	private static final String DATABASE_CREATE = "create table "
			+ TABLE_DIVIDAS + "(" + COLUMN_ID + " integer primary key autoincrement, " + 
			COLUMN_NOME + " text not null," +
			COLUMN_VALOR + " text not null," +
			COLUMN_DATAVENC + " text not null," +
			COLUMN_DATAPAG + " text not null," +
			COLUMN_NOME + " text not null," +
			");";

	public MySQLiteHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase database) {
		database.execSQL(DATABASE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.w(MySQLiteHelper.class.getName(),
				"Upgrading database from version " + oldVersion + " to "
						+ newVersion + ", which will destroy all old data");
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_DIVIDAS);
		onCreate(db);
	}

} 